##! /bin/bash
#! bash
#
#  $Id: dates.sh 3 2010-05-27 16:25:49Z alistair.mills@btinternet.com $
#
. ./defines.sh
if [ "$computer" = "$macintosh" ]
   then
   echo Macintosh
   echo This script does not work on the Mac
   exit 1
fi

### Main script stars here ###
# Store file name  here

FILE=$1
. ./defines.sh
. ./keys.sh

while read year mon cat size url key trans line
do
  if [ "$line" != "$title_line" -a "$year" != "$comment_line" ]
  then
    . ./months.sh
    . ./translators.sh
    . ./categories.sh

for i in txt htm
do
    export        tra=${year}_${mon}_${cat}
    export       item=${year}${mon}${cat}
    export    ENGLISH=${year}_${mon}_${cat}.$i
    export     FRENCH=${year}_${mon}_${cat}_fr.$i

    [ -f       ${ENGLISH} ]  || touch ${ENGLISH}
    export change_date=`date -r ${ENGLISH} +'%d %B %Y'`
    export  change_key=`date -r ${ENGLISH} +'%Y%m%d'`
    echo     ${change_date} >      ${last}${ENGLISH}
    echo     ${change_key}  >     ${key_d}${ENGLISH}
    touch -r    ${ENGLISH}         ${last}${ENGLISH}
    touch -r    ${ENGLISH}        ${key_d}${ENGLISH}
    echo Found: ${ENGLISH} '  ' - ${change_date} - ${line}

    [ -f       ${FRENCH} ]  || touch ${FRENCH}
    export change_date=`date -r ${FRENCH} +'%d %B %Y'`
    export  change_key=`date -r ${FRENCH} +'%Y%m%d'`
    echo    ${change_date} >      ${last}${FRENCH}
    echo    ${change_key}  >     ${key_d}${FRENCH}
    touch -r    ${FRENCH}         ${last}${FRENCH}
    touch -r    ${FRENCH}        ${key_d}${FRENCH}
    echo Found: ${FRENCH} - ${change_date} - ${line}
done

  fi
done < $FILE
#
#
#
